<?php
namespace app\shop\controller;
use app\AdminRest;
use app\Rest;
use think\App;
use think\Request;
use app\shop\model\AdminSellingWater as SellingWaterModel;
class AdminSellingWater extends AdminRest
{

    protected $model;
    public function __construct(App $app) {
        parent::__construct($app);
        $this->model = new SellingWaterModel();
    }

    /**
     * User: chenniang
     * Date: 2019-09-09 14:36
     * @return \think\Response
     * descption:佣金流水列表
     */
    public function waterList(){

        $where = [];

        if(!empty($this->_param['name'])){
            $name = $this->_param['name'];
            $where[] = ['c.name','like',"%{$name}%"];
            $where[] = ['b.nickName','like',"%{$name}%"];
        }
        /**
         * 查询定义
         *@status array(
         *  1 => '未入账',
         *  2 => '已入账',
         *  3 => '已退款',
         *);
         */
        if(!empty($this->_param['status'])){
            $status = $this->_param['status'];
            if($status == 3){
                $dis[] = ['a.status','=',0];
            }else{
                $dis[] = ['a.waiting','=',$status];
                $dis[] = ['a.status','<>',0];
            }
        }

        $dis[] = ['a.thing_type','=',0];

        $dis[] = ['a.uniacid','=',$this->_uniacid];

        $data = $this->model->waterListV2($dis,$this->_param['limit'],$where);

        return $this->success($data);
    }


}
